/*
 * XML Type:  XSchema
 * Namespace: http://www.seedwill.com/xul/core
 * Java type: com.seedwill.xul.core.XSchema
 *
 * Automatically generated - do not modify.
 */
package com.seedwill.xul.core.impl;
/**
 * An XML XSchema(@http://www.seedwill.com/xul/core).
 *
 * This is a complex type.
 */
public class XSchemaImpl extends com.seedwill.xul.core.impl.XIdentifiedImpl implements com.seedwill.xul.core.XSchema
{
    private static final long serialVersionUID = 1L;
    
    public XSchemaImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName TYPE$0 = 
        new javax.xml.namespace.QName("", "type");
    private static final javax.xml.namespace.QName CODE2$2 = 
        new javax.xml.namespace.QName("", "code");
    private static final javax.xml.namespace.QName PARENTSCHEMAID$4 = 
        new javax.xml.namespace.QName("", "parentSchemaId");
    private static final javax.xml.namespace.QName CHILDREN$6 = 
        new javax.xml.namespace.QName("", "children");
    
    
    /**
     * Gets the "type" element
     */
    public java.lang.String getType()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(TYPE$0, 0);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }
    
    /**
     * Gets (as xml) the "type" element
     */
    public org.apache.xmlbeans.XmlString xgetType()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(TYPE$0, 0);
            return target;
        }
    }
    
    /**
     * Sets the "type" element
     */
    public void setType(java.lang.String type)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(TYPE$0, 0);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(TYPE$0);
            }
            target.setStringValue(type);
        }
    }
    
    /**
     * Sets (as xml) the "type" element
     */
    public void xsetType(org.apache.xmlbeans.XmlString type)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(TYPE$0, 0);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlString)get_store().add_element_user(TYPE$0);
            }
            target.set(type);
        }
    }
    
    /**
     * Gets the "code" element
     */
    public java.lang.String getCode2()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(CODE2$2, 0);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }
    
    /**
     * Gets (as xml) the "code" element
     */
    public org.apache.xmlbeans.XmlString xgetCode2()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(CODE2$2, 0);
            return target;
        }
    }
    
    /**
     * Sets the "code" element
     */
    public void setCode2(java.lang.String code2)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(CODE2$2, 0);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(CODE2$2);
            }
            target.setStringValue(code2);
        }
    }
    
    /**
     * Sets (as xml) the "code" element
     */
    public void xsetCode2(org.apache.xmlbeans.XmlString code2)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(CODE2$2, 0);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlString)get_store().add_element_user(CODE2$2);
            }
            target.set(code2);
        }
    }
    
    /**
     * Gets the "parentSchemaId" element
     */
    public java.lang.String getParentSchemaId()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(PARENTSCHEMAID$4, 0);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }
    
    /**
     * Gets (as xml) the "parentSchemaId" element
     */
    public org.apache.xmlbeans.XmlID xgetParentSchemaId()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlID target = null;
            target = (org.apache.xmlbeans.XmlID)get_store().find_element_user(PARENTSCHEMAID$4, 0);
            return target;
        }
    }
    
    /**
     * Sets the "parentSchemaId" element
     */
    public void setParentSchemaId(java.lang.String parentSchemaId)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(PARENTSCHEMAID$4, 0);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(PARENTSCHEMAID$4);
            }
            target.setStringValue(parentSchemaId);
        }
    }
    
    /**
     * Sets (as xml) the "parentSchemaId" element
     */
    public void xsetParentSchemaId(org.apache.xmlbeans.XmlID parentSchemaId)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlID target = null;
            target = (org.apache.xmlbeans.XmlID)get_store().find_element_user(PARENTSCHEMAID$4, 0);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlID)get_store().add_element_user(PARENTSCHEMAID$4);
            }
            target.set(parentSchemaId);
        }
    }
    
    /**
     * Gets array of all "children" elements
     */
    public com.seedwill.xul.core.XSchema[] getChildrenArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(CHILDREN$6, targetList);
            com.seedwill.xul.core.XSchema[] result = new com.seedwill.xul.core.XSchema[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "children" element
     */
    public com.seedwill.xul.core.XSchema getChildrenArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XSchema target = null;
            target = (com.seedwill.xul.core.XSchema)get_store().find_element_user(CHILDREN$6, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "children" element
     */
    public int sizeOfChildrenArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(CHILDREN$6);
        }
    }
    
    /**
     * Sets array of all "children" element
     */
    public void setChildrenArray(com.seedwill.xul.core.XSchema[] childrenArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(childrenArray, CHILDREN$6);
        }
    }
    
    /**
     * Sets ith "children" element
     */
    public void setChildrenArray(int i, com.seedwill.xul.core.XSchema children)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XSchema target = null;
            target = (com.seedwill.xul.core.XSchema)get_store().find_element_user(CHILDREN$6, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(children);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "children" element
     */
    public com.seedwill.xul.core.XSchema insertNewChildren(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XSchema target = null;
            target = (com.seedwill.xul.core.XSchema)get_store().insert_element_user(CHILDREN$6, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "children" element
     */
    public com.seedwill.xul.core.XSchema addNewChildren()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XSchema target = null;
            target = (com.seedwill.xul.core.XSchema)get_store().add_element_user(CHILDREN$6);
            return target;
        }
    }
    
    /**
     * Removes the ith "children" element
     */
    public void removeChildren(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(CHILDREN$6, i);
        }
    }
}
